package routes

import (
	"gin-blog/utils"
	"net/http"
	"github.com/gin-gonic/gin"
)

func InitRouter()  {
	gin.SetMode(utils.AppMode)
	//用New()也可以
	r := gin.Default()
	r.LoadHTMLGlob("./templates/**/*")
	r.Static("/static","./static")
	//路由分组管理
	frontRouter := r.Group("/")
	{
		frontRouter.GET("/",func (c *gin.Context)  {
			c.HTML(http.StatusOK, "front/index.html",gin.H{
				"num" : 3,
			})
		})
	}
	r.Run(utils.HttpPort)
}